<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../publics/jstl.jsp" %>
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta content="telephone=no" name="format-detection" />
</head>
<body>
<script src="${ctx}/resource/static/js/jquery.min.js"> </script>
<script src="${ctx}/resource/static/js/user.js?v=1"></script>
<script>
function onBridgeReady(){
    WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId" : "${appId}",
                "timeStamp" : "${timeStamp}",
                "nonceStr" : "${nonceStr}",
                "package" : "${_package}",
                "signType" : "${signType}",
                "paySign" : "${paySign}"
    }, function(res){
        if(res.err_msg == "get_brand_wcpay_request:ok"){
            window.location.href = '${ctx}/h5/home/index';
            <%--mobile.modal.alert({--%>
                <%--content: '支付成功',--%>
                <%--callback: function(){--%>
                    <%--window.location.href = '${ctx}/h5/home/index';--%>
                <%--}--%>
            <%--})--%>
        } else {
            window.location.href = '${ctx}/h5/home/index';
//            mobile.modal.alert({
//                content: '支付失败',
//                callback: function(){
//                }
//            })
        }
    });
}
if (typeof WeixinJSBridge == "undefined"){
    if( document.addEventListener ){
        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
    }else if (document.attachEvent){
        document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
    }
}else{
    onBridgeReady();
}
</script>
</body>